<?php

declare(strict_types=1);

namespace Modules\Intelligent\Models;

use Catch\Base\CatchModel as Model;

/**
 * @property $id
 * @property $creator_id
 * @property $created_at
 * @property $updated_at
 * @property $deleted_at
 * @property $othernumbers
 * @property $incomingtype
 * @property $deliverydate
 * @property $state
 * @property $remark
 * @property $backstate
 * @property $writeback
*/
class Otheroutboundfrom extends Model
{
    

    protected $table = 'otheroutboundfrom';

     /**
     * 数据表查询
     *@$fields  string
     *@$where  []
     *@$limit  string
     */
    public static $Type = [
        [
            'label'=>'盘亏出库',
            'value'=>'QW005',
            'child'=>['仓储+物流部'=>'BM000009']
        ],
        [
            'label'=>'申请样品出库',
            'value'=>'QW006',
            'child'=>[
                '生产部'=>'QW004YF',
                '研发部'=>'QW004SC',
                ]
        ],
    ];

    protected $fillable = [ 'id', 'creator_id', 'created_at', 'updated_at', 'deleted_at', 'othernumbers', 'incomingtype', 'deliverydate', 'state', 'remark', 'backstate', 'writeback' ,'area','docno','leveltype','fownertypeid','fownerid_number'];

    /**
     * @var array
     */
    protected array $fields = ['id','created_at','updated_at','othernumbers','incomingtype','deliverydate','state','remark','backstate','writeback' ,'area','docno','leveltype','fownertypeid','fownerid_number'];

    /**
     * @var array
     */
    protected array $form = ['id','created_at','updated_at','othernumbers','incomingtype','deliverydate','state','remark','backstate','writeback' ,'area','docno','leveltype','fownertypeid','fownerid_number'];

       /**
     * @var array
     */
    public array $searchable = [
        'othernumbers' => 'like',
        'incomingtype' => '=',
        'deliverydate' => '=',
        'state' => '=',
        'remark' => 'like',
        'backstate' => 'like',
        'writeback' => 'like',
    ];
    
    //输出相应的时间格式
    protected function serializeDate($date)
    {
        return $date->format('Y-m-d H:i');
    }

     /**
     * 链表查询
     */
    public function detailscheckOne()
    {
        return $this->hasOne(OtheroutboundfromSchedule::class);//查一条
    }

    public function detailscheckAll()
    {
        return $this->hasMany(OtheroutboundfromSchedule::class);//查多条
    }
    
    //打印链表
    public function BarcodeprintingAll()
    {
        return $this->hasMany(OtheroutboundfromSchedule::class);//查多条
    }


    
}
